// view or edit profile here

import 'dart:io';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:image_picker/image_picker.dart';
import 'package:karyo/karyo.dart';
import 'package:karyo/src/login/bloc/login_bloc.dart';
import 'package:karyo/src/login/components/rounded_button.dart';
import 'package:karyo/src/models/user.dart';
import 'package:bouncing_widget/bouncing_widget.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';

import 'crop_image_page.dart';

class ProfilePage extends StatefulWidget {
  @override
  _ProfilePageState createState() => _ProfilePageState();
}

class _ProfilePageState extends State<ProfilePage> {
  static final GlobalKey<FormState> _nameKey = GlobalKey<FormState>();
  static final GlobalKey<FormState> _editPasswdKey = GlobalKey<FormState>();
  static final GlobalKey<FormState> _genderKey = GlobalKey<FormState>();
  static final GlobalKey<FormState> _descriptionlKey = GlobalKey<FormState>();
  static final GlobalKey<FormState> _hobbiesKey = GlobalKey<FormState>();
  static final GlobalKey<FormState> _maneKey = GlobalKey<FormState>();
  static final GlobalKey<FormState> _datetimeKey = GlobalKey<FormState>();

  static final FocusNode _nameNode = FocusNode();
  static final FocusNode _descriptionNode = FocusNode();

  final TextEditingController _nickNameController = new TextEditingController();
  final TextEditingController _signController = new TextEditingController();

  String _selectedGender = '女';
  String _nickNameInput;
  String _signInput;
  bool _autoValidate = false;
  final picker = ImagePicker();
  LoginBloc loginBloc = new LoginBloc();

  Future getImage(BuildContext context, LoginBloc bloc) async {
    await picker
        .getImage(source: ImageSource.gallery, maxWidth: 350)
        .then((value) {
      cropImage(File(value.path), context, bloc);
    });
    // _pickedImgFile.add(File(image.path));
    // selectedAvatarFile = File(image.path);
  }

  void cropImage(
      File originalImage, BuildContext context, LoginBloc bloc) async {
    String result =
        await Navigator.push(context, MaterialPageRoute(builder: (context) {
      return BlocProvider(
        child: CropImageRoute(originalImage),
        bloc: bloc,
      );
    }));
    if (result.isEmpty) {
      print('上传失败');
    } else {
      //result是图片上传后拿到的url
    }
  }

  @override
  void initState() {
    print('will profile init call many times?');
    loginBloc.helloGetUser();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    // LoginBloc loginBloc = BlocProvider.of(context);
    Widget appBar(BuildContext context) {
      return CupertinoNavigationBar(
          backgroundColor: Colors.transparent,
          border: Border(bottom: BorderSide(color: Colors.transparent)),
          automaticallyImplyLeading: false,
          // leading: CupertinoButton(
          //   padding: EdgeInsets.all(0),
          //   child: Text(
          //     '取消',
          //     style: NORMAL_BOLD_TXT_STYLE.copyWith(color: COLOR_PRIMARY_APP),
          //   ),
          //   onPressed: () {
          //     Navigator.pop(context, null);
          //   },
          // ),
          // middle: Text('更新个人资料',
          //     style: NORMAL_BOLD_TXT_STYLE.copyWith(color: COLOR_PRIMARY)),
          trailing: CupertinoButton(
            padding: EdgeInsets.all(0),
            child: Text(
              '取消',
              style: NORMAL_BOLD_TXT_STYLE.copyWith(color: COLOR_PRIMARY),
            ),
            onPressed: () {
              Navigator.of(context).pop();
            },
          ));
    }

    return CupertinoPageScaffold(
        navigationBar: appBar(context),
        child: ListView(
          children: [
            SizedBox(
              height: 12,
            ),
            Center(
              child: BouncingWidget(
                child: StreamBuilder(
                  stream: loginBloc.pickedImgFile,
                  builder: (context, snapshot) {
                    if (snapshot.hasData) {
                      return PhysicalModel(
                          color: Colors.grey.withAlpha(60),
                          borderRadius: BorderRadius.circular(48),
                          elevation: 10,
                          child: CircleAvatar(
                            radius: 48,
                            backgroundColor:
                                GlobalSettings.vipStatus == VIPStatus.VIP_OK
                                    ? ColorBook.yellowVIP
                                    : Colors.transparent,
                            // backgroundColor:Colors.transparent,
                            child: CircleAvatar(
                              backgroundImage: FileImage(snapshot.data),
                              radius: 45.0,
                            ),
                          ));
                    } else {
                      return PhysicalModel(
                          color: Colors.grey.withAlpha(1),
                          borderRadius: BorderRadius.circular(48),
                          elevation: 8,
                          child: CircleAvatar(
                            radius: 48,
                            backgroundColor:
                                GlobalSettings.vipStatus == VIPStatus.VIP_OK
                                    ? ColorBook.yellowVIP
                                    : Colors.transparent,
                            // backgroundColor:Colors.transparent,
                            child: CircleAvatar(
                              backgroundImage: GlobalSettings.user != null
                                  ? GlobalSettings.user.userAvatarImage
                                  : AssetImage(
                                      'assets/images/blank_avatar.png'),
                              radius: 45.0,
                            ),
                          ));
                    }
                  },
                ),
                onPressed: () {
                  // Navigator.push(
                  //     context,
                  //     CupertinoPageRoute<bool>(
                  //       builder: (context) => WelcomeScreen(),
                  //     ));
                  getImage(context, loginBloc);
                },
              ),
            ),
            Container(
                // padding: EdgeInsets.only(bottom: 64),
                child: StreamBuilder(
              stream: loginBloc.user,
              builder: (context, snapshot) {
                if (snapshot.hasData) {
                  User user = snapshot.data;
                  if (_nickNameInput != null) {
                    _nickNameController.text = _nickNameInput;
                  } else {
                    _nickNameController.text = user.userNickName;
                  }
                  if (_signInput != null) {
                    _signController.text = _signInput;
                  } else {
                    _signController.text = user.userSign;
                  }

                  _nickNameController.selection = TextSelection.fromPosition(
                    TextPosition(offset: _nickNameController.text.length),
                  );
                  _signController.selection = TextSelection.fromPosition(
                    TextPosition(offset: _signController.text.length),
                  );

                  return Theme(
                    data: Theme.of(context).copyWith(
                      dividerColor: Colors.grey.withAlpha(20),
                      cardTheme: CardTheme(
                        shadowColor: Colors.grey.withAlpha(30),
                        elevation: 14,
                        shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(22)),
                      ),
                      primaryTextTheme: TextTheme(
                        headline6: TextStyle(
                            color: Colors.lightBlue[50]), // app header text
                      ),
                      inputDecorationTheme: InputDecorationTheme(
                        labelStyle:
                            TextStyle(color: COLOR_PRIMARY), // style for labels
                      ),
                    ),
                    child: Column(children: [
                      SizedBox(height: 58),
                      buildRoundedListTile(
                          context,
                          Text(
                            "昵称:",
                            style: NORMAL_BOLD_TXT_STYLE,
                          ),
                          CupertinoTextField(
                              decoration: BoxDecoration(
                                  borderRadius: BorderRadius.circular(12)),
                              cursorHeight: 22.0,
                              cursorRadius: Radius.circular(4),
                              cursorColor: COLOR_PRIMARY,
                              // placeholder: user.userNickName,
                              controller: _nickNameController,
                              maxLength: 10,
                              onChanged: (v) {
                                _nickNameInput = v;
                                _nickNameController.text = v;
                                _nickNameController.selection =
                                    TextSelection.fromPosition(
                                  TextPosition(
                                      // affinity: TextAffinity.downstream,
                                      offset: _nickNameController.text.length),
                                );
                              },
                              textInputAction: TextInputAction.next,
                              onEditingComplete: () {
                                print('unfocus..');
                                FocusScope.of(context).unfocus();
                              },
                              style: NORMAL_BOLD_TXT_STYLE),
                          Container(),
                          Icon(
                            FlutterIcons.chevron_small_right_ent,
                            color: Colors.grey.withAlpha(80),
                            size: 22,
                          ),
                          true,
                          false,
                          () {}),
                      buildRoundedListTile(
                          context,
                          Text(
                            "账号:",
                            style: NORMAL_BOLD_TXT_STYLE,
                          ),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            children: [
                              Text(
                                user.userAcc,
                                style: NORMAL_TXT_STYLE.copyWith(
                                    color: Colors.grey),
                              ),
                            ],
                          ),
                          Container(),
                          Icon(
                            FlutterIcons.chevron_small_right_ent,
                            color: Colors.grey.withAlpha(80),
                            size: 22,
                          ),
                          false,
                          false,
                          () {}),
                      buildRoundedListTile(
                          context,
                          Text(
                            "性别:",
                            style: NORMAL_BOLD_TXT_STYLE,
                          ),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            children: [
                              Text('${_selectedGender}'),
                            ],
                          ),
                          Container(),
                          Icon(
                            FlutterIcons.chevron_small_right_ent,
                            color: Colors.grey.withAlpha(80),
                            size: 22,
                          ),
                          false,
                          false, () {
                        YYDialog().build(context)
                          ..width = 280
                          ..borderRadius = 4.0
                          ..listViewOfListTile(
                              items: [
                                ListTileItem(
                                  padding: EdgeInsets.symmetric(
                                      horizontal: 12, vertical: 0),
                                  leading: Column(
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [Container(
                                    width: 20,
                                    height: 20,
                                    child:
                                        Image.asset("assets/images/ic_man.png"),
                                  ),]),
                                  text: "男",
                                  color: Colors.grey,
                                  fontSize: 20.0,
                                ),
                                ListTileItem(
                                  padding: EdgeInsets.symmetric(
                                      horizontal: 12, vertical: 0),
                                  leading: Column(
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [Container(
                                    width: 20,
                                    height: 20,
                                    child: Image.asset(
                                        "assets/images/ic_woman.png"),
                                  )]),
                                  text: "女",
                                  color: Colors.grey,
                                  fontSize: 20.0,
                                ),
                                ListTileItem(
                                  padding: EdgeInsets.symmetric(
                                      horizontal: 12, vertical: 0),
                                  leading: Column(
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [
                                        Container(
                                          width: 20,
                                          height: 20,
                                          child: Image.asset(
                                              "assets/images/ic_bot.png"),
                                        )
                                      ]),
                                  text: "机器人",
                                  color: Colors.grey,
                                  fontSize: 20.0,
                                ),
                              ],
                              onClickItemListener: (index) {
                                print(index);
                                print(_selectedGender);
                                switch (index) {
                                  case 0:
                                    setState(() {
                                      _selectedGender = '男';
                                    });
                                    break;
                                  case 1:
                                    setState(() {
                                      _selectedGender = '女';
                                    });
                                    break;
                                  case 2:
                                    setState(() {
                                      _selectedGender = '机器人';
                                    });
                                    break;
                                  default:
                                    setState(() {
                                      _selectedGender = '女';
                                    });
                                    break;
                                }
                              })
                          ..show();
                      }),
                      buildRoundedListTile(
                          context,
                          Text(
                            "密码:",
                            style: NORMAL_BOLD_TXT_STYLE,
                          ),
                          CupertinoTextField(
                            decoration: BoxDecoration(
                                color: Colors.transparent,
                                borderRadius: BorderRadius.circular(12)),
                            cursorHeight: 22.0,
                            cursorRadius: Radius.circular(4),
                            cursorColor: COLOR_PRIMARY,
                            placeholder: user.userPwd,
                            style: NORMAL_BOLD_TXT_STYLE,
                            // enabled: false,
                            readOnly: true,
                            // controller: _,
                          ),
                          Container(),
                          Icon(
                            FlutterIcons.chevron_small_right_ent,
                            color: Colors.grey.withAlpha(80),
                            size: 22,
                          ),
                          false,
                          false, () {
                        showToast(context, '密码暂时不支持修改', COLOR_PRIMARY);
                      }),
                      buildRoundedListTileDescBox(
                          context,
                          Text(
                            "你的签名:",
                            style: NORMAL_BOLD_TXT_STYLE,
                          ),
                          Container(
                            child: CupertinoTextField(
                              padding: EdgeInsets.all(10),
                              cursorHeight: 22.0,
                              cursorRadius: Radius.circular(4),
                              cursorColor: COLOR_PRIMARY,
                              decoration: BoxDecoration(
                                  color: Colors.grey.withAlpha(10),
                                  borderRadius: BorderRadius.circular(12)),
                              placeholder: "一句话描述你",
                              style:
                                  NORMAL_TXT_STYLE.copyWith(color: Colors.grey),
                              controller: _signController,
                              maxLength: 80,
                              textAlign: TextAlign.start,
                              textAlignVertical: TextAlignVertical.top,
                              textInputAction: TextInputAction.done,
                              onChanged: (v) {
                                _signInput = v;
                                _signController.text = v;
                                _signController.selection =
                                    TextSelection.fromPosition(
                                  TextPosition(
                                      // affinity: TextAffinity.downstream,
                                      offset: _signController.text.length),
                                );
                              },
                            ),
                            height: 80,
                          ),
                          Container(),
                          false,
                          true,
                          () {}),
                    ]),
                  );
                } else {
                  return Center(
                    child: Container(
                      // width: 30,
                      padding: EdgeInsets.all(32),
                      child: CircularProgressIndicator(
                        // color: COLOR_PRIMARY,
                      ),
                    ),
                  );
                }
              },
            )),
            SizedBox(
              height: 16,
            ),
            StreamBuilder(
              stream: loginBloc.user,
              builder: (context, snapshot) {
                if (!snapshot.hasData) {
                  return Padding(
                    padding: EdgeInsets.all(16),
                    child: FlatButton(
                        color: COLOR_PRIMARY,
                        onPressed: () {
                          showToast(context, '未登录无法修改', COLOR_PRIMARY);
                        },
                        child: Padding(
                          padding: EdgeInsets.symmetric(vertical: 12),
                          child: Text(
                            "更新信息",
                            style: NORMAL_BOLD_TXT_STYLE.copyWith(
                                color: Colors.white),
                          ),
                        )),
                  );
                } else {
                  User _u = snapshot.data;
                  return Padding(
                    padding: EdgeInsets.all(16),
                    child: RoundedButton(
                        color: COLOR_PRIMARY,
                        press: () {
                          if (_nickNameController.text == '') {
                            showToast(context, "昵称不能为空", COLOR_PRIMARY);
                          } else if (_nickNameController.text.length > 9) {
                            showToast(context, "昵称长度不能大于九个字符", COLOR_PRIMARY);
                          } else {
                            _u.userNickName = _nickNameController.text;
                            _u.userSign = _signController.text;
                            var _g = '0';
                            switch (_selectedGender) {
                              case '男':
                                _g = '0';
                                break;
                              case '女':
                                _g = '1';
                                break;
                              default:
                                _g = '2';
                            }
                            _u.userGender = _g;
                            if (loginBloc.selectedAvatarFile != null) {
                              _u.selectedImgAvatar =
                                  loginBloc.selectedAvatarFile;
                              print(
                                  'selectd avatar: ${loginBloc.selectedAvatarFile}');
                            }
                            print(
                                'selectd avatar: ${loginBloc.selectedAvatarFile}');
                            loginBloc.updateUser(_u, context).then((value) {
                              showToast(context, "更新成功", Colors.green);
                              Navigator.pop(context);
                            });
                          }
                        },
                        text: '更新信息'),
                  );
                }
              },
            )
          ],
        ));
  }

  Widget buildRoundedListTile(
      BuildContext context,
      Widget leading,
      Widget title,
      Widget subtitle,
      Widget tailing,
      bool roundTop,
      bool roundBottom,
      onTap,
      {onTapDown}) {
    BorderRadius radius = BorderRadius.zero;
    double _radius = 16;
    if (roundTop) {
      radius = BorderRadius.only(
          topLeft: Radius.circular(_radius),
          topRight: Radius.circular(_radius));
    }
    if (roundBottom) {
      radius = BorderRadius.only(
          bottomLeft: Radius.circular(_radius),
          bottomRight: Radius.circular(_radius));
    }

    if (roundBottom && roundTop) {
      radius = BorderRadius.only(
          topLeft: Radius.circular(_radius),
          topRight: Radius.circular(_radius),
          bottomLeft: Radius.circular(_radius),
          bottomRight: Radius.circular(_radius));
    }
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: 16),
      child: Card(
        elevation: 10,
        margin: EdgeInsets.all(0),
        shape: RoundedRectangleBorder(borderRadius: radius),
        // color: Colors.grey.withAlpha(10),
        color: Theme.of(context).dialogBackgroundColor,
        shadowColor: Colors.grey.withAlpha(20),
        child: InkWell(
            borderRadius: radius,
            onTap: onTap,
            onTapDown: onTapDown,
            child: Padding(
              padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
              child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
                SizedBox(
                  width: 12,
                ),
                leading,
                SizedBox(
                  width: 18,
                ),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      title,
                      SizedBox(height: 2),
                      Wrap(
                        children: [subtitle],
                      )
                    ],
                  ),
                ),
                // Row(
                //   mainAxisAlignment: MainAxisAlignment.end,
                //   children: <Widget>[, SizedBox(width: 8)],
                // ),
                SizedBox(
                  height: 32,
                  child: tailing,
                ),
                SizedBox(width: 8),
              ]),
            )),
      ),
    );
  }

  Widget buildRoundedListTileDescBox(BuildContext context, Widget title,
      Widget subtitle, Widget tailing, bool roundTop, bool roundBottom, onTap,
      {onTapDown}) {
    BorderRadius radius = BorderRadius.zero;
    double _radius = 16;
    if (roundTop) {
      radius = BorderRadius.only(
          topLeft: Radius.circular(_radius),
          topRight: Radius.circular(_radius));
    }
    if (roundBottom) {
      radius = BorderRadius.only(
          bottomLeft: Radius.circular(_radius),
          bottomRight: Radius.circular(_radius));
    }

    if (roundBottom && roundTop) {
      radius = BorderRadius.only(
          topLeft: Radius.circular(_radius),
          topRight: Radius.circular(_radius),
          bottomLeft: Radius.circular(_radius),
          bottomRight: Radius.circular(_radius));
    }
    return Padding(
      padding: EdgeInsets.symmetric(horizontal: 16),
      child: Card(
        elevation: 10,
        margin: EdgeInsets.all(0),
        shape: RoundedRectangleBorder(borderRadius: radius),
        // color: Colors.grey.withAlpha(10),
        color: Theme.of(context).dialogBackgroundColor,
        shadowColor: Colors.grey.withAlpha(20),
        child: InkWell(
            borderRadius: radius,
            onTap: onTap,
            onTapDown: onTapDown,
            child: Padding(
              padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
              child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
                SizedBox(
                  width: 12,
                ),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      title,
                      SizedBox(height: 8),
                      Wrap(
                        children: [subtitle],
                      )
                    ],
                  ),
                ),
                // Row(
                //   mainAxisAlignment: MainAxisAlignment.end,
                //   children: <Widget>[, SizedBox(width: 8)],
                // ),
                SizedBox(
                  height: 32,
                  child: tailing,
                ),
                SizedBox(width: 8),
              ]),
            )),
      ),
    );
  }

  // CardSettingsText _buildCardSettingsTextName(User user) {
  //   return CardSettingsText(
  //     fieldPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 12),
  //     key: _nameKey,
  //     label: '昵称',
  //     hintText: '昵称可以随意修改',
  //     style: NORMAL_TXT_STYLE,
  //     autovalidate: _autoValidate,
  //     inputAction: TextInputAction.next,
  //     inputActionNode: _descriptionNode,
  //     controller: _nickNameController,
  //     validator: (value) {
  //       if (value == null || value.isEmpty) return 'Name is required.';
  //       return null;
  //     },
  //     onSaved: (value) {
  //       // how to gather those updates?
  //     },
  //     onChanged: (value) {},
  //   );
  // }

  // CardSettingsText _buildCardSettingsTextDisabled(User user) {
  //   return CardSettingsText(
  //     label: 'Daybreak账号',
  //     hintText: user.userAcc,
  //     enabled: false,
  //   );
  // }

  // CardSettingsText _buildCardSettingsEditPassword(User user) {
  //   return CardSettingsPassword(
  //     key: _editPasswdKey,
  //     label: '密码',
  //     hintText: '修改密码',
  //     // autovalidate: _autoValidate,
  //     inputAction: TextInputAction.next,
  //     inputActionNode: _descriptionNode,
  //     validator: (value) {
  //       if (value == null || value.isEmpty) return 'Name is required.';
  //       return null;
  //     },
  //     onSaved: (value) => _ponyModel.name = value,
  //     onChanged: (value) {},
  //   );
  // }

  // CardSettingsDateTimePicker _buildCardSettingsDateTimePickerBirthday(
  //     User user) {
  //   return CardSettingsDateTimePicker(
  //     key: _datetimeKey,
  //     icon: Icon(Icons.card_giftcard, color: Colors.yellow[700]),
  //     label: '生日',
  //     initialValue: DateTime.parse(user.userBirth),
  //     onSaved: (value) => _ponyModel.showDateTime =
  //         updateJustDate(value, _ponyModel.showDateTime),
  //     onChanged: (value) {},
  //   );
  // }

  // CardSettingsColorPicker _buildCardSettingsColorPickerMane() {
  //   return CardSettingsColorPicker(
  //     key: _maneKey,
  //     label: '对外展示主题色',
  //     initialValue: intelligentCast<Color>(_ponyModel.maneColor),
  //     // autovalidate: _autoValidate,
  //     pickerType: CardSettingsColorPickerType.material,
  //     validator: (value) {
  //       if (value.computeLuminance() > .7) return 'This color is too light.';
  //       return null;
  //     },
  //     onSaved: (value) => _ponyModel.maneColor = colorToString(value),
  //     onChanged: (value) {},
  //   );
  // }

  // CardSettingsCheckboxPicker _buildCardSettingsCheckboxPickerHobbies() {
  //   return CardSettingsCheckboxPicker(
  //     key: _hobbiesKey,
  //     label: '我的标签',
  //     initialValues: _ponyModel.hobbies,
  //     options: allHobbies,
  //     // autovalidate: _autoValidate,
  //     validator: (List<String> value) {
  //       if (value == null || value.isEmpty)
  //         return 'You must pick at least one hobby.';

  //       return null;
  //     },
  //     onSaved: (value) => _ponyModel.hobbies = value,
  //     onChanged: (value) {},
  //   );
  // }

  // CardSettingsParagraph _buildCardSettingsParagraphDescription(User user) {
  //   return CardSettingsParagraph(
  //     key: _descriptionlKey,
  //     label: '个性签名',
  //     maxLength: 30,
  //     controller: _signController,
  //     numberOfLines: 2,
  //     focusNode: _descriptionNode,
  //     onSaved: (value) => _ponyModel.description = value,
  //     onChanged: (value) {},
  //   );
  // }

  // CardSettingsRadioPicker _buildCardSettingsRadioPickerGender(User user) {
  //   return CardSettingsRadioPicker(
  //     key: _genderKey,
  //     label: '性别',
  //     initialValue: user.userGender,
  //     hintText: '女',
  //     // autovalidate: _autoValidate,
  //     options: <String>['男', '女', '保密'],
  //     validator: (String value) {
  //       if (value == null || value.isEmpty) return 'You must pick a gender.';
  //       return null;
  //     },
  //     onSaved: (value) {
  //       print('one save.');
  //     },
  //     onChanged: (value) {
  //       print('onChange.');
  //       _selectedGender = value;
  //     },
  //   );
  // }
}
